function siteHeader(){}

$.extend(siteHeader.prototype , {
    init : function(){
        console.log("i am site-header");
        this.logo_img = $(".logoImg");
        this.nav_top  = $("#nav-top");
        this.col      = $(".col-xs-1");

        this.logo_img.on("click",$.proxy(this.reloadPage,this));
        this.nav_top.on("mouseenter",".col-xs-1",$.proxy(this.showItem,this));
        this.nav_top.on("mouseleave",".col-xs-1",$.proxy(this.noneItem,this));
        this.nav_top.on("mouseleave",".col-xs-1",$.proxy(this.noneItem,this));
    },
    reloadPage : function(){
        location.reload();
    },
    showItem : function(evt){
        var e = evt || window.event;
        var target = e.target || e.srcElement; 
        // if(target.nodeName === "A")  return false; 快哭了
        if($(target.children[1]).hasClass("item"))  
        $(target.children[1]).hasClass("item-show") ? "" : $(target.children[1]).addClass("item-show");       
    },
    noneItem : function(evt){
        var e = evt || window.event;
        var target = e.target || e.srcElement; 
       
        $(target.children[1]).removeClass("item-show")
        if(target.closest('.item-show') === null) return false;     
        $(target.closest('.item-show')).removeClass("item-show") ;
    }
})

export default new siteHeader();